package com.d0330.homework;

public class Account implements Comparable {
    private String name;
    private int money;

    public Account() {
    }

    public Account(String name, int money) {
        this.name = name;
        this.money = money;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    @Override
    public String toString() {
        return "Account{" +
                "name='" + name + '\'' +
                ", money=" + money +
                '}';
    }

    @Override
    public int compareTo(Object o) {
        if (o instanceof Account) {
            Account account = (Account) o;
            if (this.money > account.money) {
                return -1;
            } else if (this.money < account.money) {
                return 1;
            } else {
                return 0;
            }
        }
        return 0;
    }
}
